window.addEventListener('load', function() {
    let returnTop = document.getElementById('returnTop');
    window.addEventListener('scroll', function() {
        let sTop = document.documentElement.scrollTop;
        if (sTop >= 300) {
            returnTop.style.display = 'block';
        } else {
            returnTop.style.display = 'none';
        }
    })
    let timeId = null;
    returnTop.addEventListener('click', function() {
        window.clearInterval(timeId);
        timeId = window.setInterval(function() {
            let sTop = document.documentElement.scrollTop;
            document.documentElement.scrollTop = sTop - 10;
            if (sTop <= 0) {
                window.clearInterval(timeId)
            }

        }, 0.5);
    })
})